import request from "@/utils/request";

const clientId = '209ef407810e3856f40870a9f0e769d7';

/**
 * 登录
 */
export function login(data) {
    const params = {
        ...data,
        clientId: data.clientId || clientId,
        grantType: data.grantType || 'password'
    };
    return request({
        url: '/auth/login',
        method: 'post',
        data: params
    });
}
/**
 * 获取验证码
 */
export function getCodeImg() {
    return request({
        url: '/auth/code',
        method: 'get',
        timeout: 20000
    });
}

/**
 * 注册方法
 */
export function register(data) {
    const params = {
        ...data,
        clientId: clientId,
        grantType: 'password'
    };
    return request({
        url: '/auth/register',
        headers: {
            isToken: false,
            isEncrypt: true
        },
        method: 'post',
        data: params
    });
}